package com.ehome.poct.core.api.vo.patient;

import com.ehome.poct.core.api.common.ValueConst;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * @author 瑶苏
 * @since 2021/09/22 16:42
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@ApiModel("患者分页返回")
public class PatientDetailVO {
    @ApiModelProperty("患者ID")
    private Long patientId;
    @ApiModelProperty("终端ID")
    private Long clinicId;
    @ApiModelProperty("用户名字")
    private String userName;
    @ApiModelProperty(value = "用户手机号", required = true)
    private String mobilePhone;
    @ApiModelProperty(value = "用户年龄（年份）", required = true)
    private Integer userAge;
    @ApiModelProperty(value = "用户年龄（月份）", required = true)
    private Integer userMonth;
    @ApiModelProperty(value = "性别",notes = "1：男，2：女", required = true)
    private Integer userSex;

    /**
     * 金标仪 端的 3岁以下是儿童
     * 1 成年  0 儿童
     * @return
     */
    public Integer FindAgeType() {
        if (userAge == null && userMonth == null) {
            return 1;
        }
        if (userAge != null && userAge.intValue() > ValueConst.VAL_3) {
            return 1;
        }
        return 0;
    }

    public Integer getPatientType() {
        if (userAge == null && userMonth == null) {
            return 2;
        }
        if (userAge == null || userAge <= 14) {
            return 1;
        } else if (userSex == 2) {
            return 3;
        }
        return 2;
    }
}